from wcs.libs.players import players
from wcs.libs.items import items

itemName = "Secondary Clip Enhancement"
item = items.addItem(itemName)
item.setGroup("attack")
item.setCost(400)
item.setDescription("You magically conjur an additional clip for your weapon.")
item.aliveToUse = True
item.appendToUser = False

def wcs_item_bought(event_var):
    """
    Executed when a player has purchased an item. If the item purcahsed was this
    item, then ensure that we add to the player's weapon clip value.
    """
    if event_var['item'] == itemName:
        userid = event_var["userid"]
        player = players[userid]
        player.ammoAdd(50)
